﻿using EntityFrameworkETL.Interfaces;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EntityFrameworkETL.Test.Mocks
{
    public class RepositoryMock: IRepository
    {
        public RepositoryMock()
        {

        }

        public void SetSourceItems<T>(List<T> sourceItems)
        {
            SourceItems = sourceItems;
        }

        private object SourceItems { get; set; }
        public IEnumerable<T> SelectSource<T>() where T : class
        {
            return (List<T>)SourceItems;
        }

        public IEnumerable<DbCommand> GetInsertCommands<T>(IEnumerable<T> items, bool identityInsert) where T : class
        {
            List<DbCommand> results = new List<DbCommand>();
            foreach (var item in items)
            {
                results.Add(new SqlCommand());
            }
            return results;
        }

        public string DestinationConnectionString()
        {
            return string.Empty;
        }


        public IEnumerable<DbCommand> GetDeleteCommands<T>(IEnumerable<T> items) where T : class
        {
            throw new NotImplementedException();
        }

        public IEnumerable<T> SelectDestinationForDelete<T>() where T : class
        {
            throw new NotImplementedException();
        }

        public IEnumerable<T> SelectSource<T>(Func<IQueryable<T>, IQueryable<T>> query) where T : class
        {
            return (List<T>)SourceItems;
        }

        public void DeleteAll<T>() where T : class
        {
            throw new NotImplementedException();
        }
    }
}
